package com.imut.service.impl;

import com.imut.entity.Novel;
import com.imut.entity.NovelImage;
import com.imut.mapper.NovelMapper;
import com.imut.service.NovelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author jiangYaPeng
 * @Date 2025-07-08 16:42
 */
@Service
public class NovelServiceImpl implements NovelService {
    @Autowired
    private NovelMapper novelMapper;

    @Override
    public List<Novel> selectAll(Novel novel) {
        return novelMapper.selectAll(novel);
    }

    @Override
    public Novel selectById(Long id) {
        return novelMapper.selectById(id);
    }

    @Override
    public Boolean insert(Novel novel) {
        int insert = novelMapper.insert(novel);
        return insert != 0;
    }

    @Override
    public Boolean update(Novel novel) {
        int update = novelMapper.update(novel);
        return update != 0;
    }

    @Override
    public Boolean deleteById(Long id) {
        int delete = novelMapper.deleteById(id);
        return delete != 0;

    }

    public void insertUserFile(NovelImage novelImage) {
        novelMapper.insertUserFile(novelImage);
    }


}
